/**
 * 
 */
package org.t2.game.server.module.server.model;

import java.time.LocalDateTime;
import java.util.HashSet;
import java.util.Set;

import org.banish.sql.core.annotation.Column;
import org.banish.sql.core.annotation.Id;
import org.banish.sql.core.annotation.Table;
import org.banish.sql.core.annotation.Id.Strategy;
import org.banish.sql.core.annotation.enuma.AsyncType;
import org.banish.sql.core.entity.AbstractEntity;
import org.gaming.service.repository.annotation.JvmCache;
import org.gaming.tool.DateTimeUtil;
import org.gaming.tool.LocalDateTimeUtil;
import org.springframework.stereotype.Repository;

/**
 * 
 */
@Repository
@JvmCache(cacheTime = 0)
@Table(comment = "服务器数据表", dbAlias = "game", asyncType = AsyncType.UPDATE)
public class ServerInfo extends AbstractEntity {
	@Id(strategy = Strategy.IDENTITY)
	@Column(comment = "服务器ID")
	private int id;
	@Column(comment = "是否已经开服")
	private boolean opened;
	@Column(comment = "是否维护中")
	private boolean maintain;
	@Column(name = "open_time", comment = "服务器预计开服时间")
	private LocalDateTime openTime = LocalDateTimeUtil.now();
	@Column(name = "merge_servers", comment = "已处理合服的服务器", extra = "text")
	private Set<Integer> mergeServers = new HashSet<>();
	@Column(name = "daily_time", comment = "每日重置时间")
	private LocalDateTime dailyTime = LocalDateTime.now();
	@Column(name = "heart_beat_time", comment = "心跳时间", extra = "time")
	private long heartBeatTime = DateTimeUtil.currMillis();
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public boolean isOpened() {
		return opened;
	}
	public void setOpened(boolean opened) {
		this.opened = opened;
	}
	public boolean isMaintain() {
		return maintain;
	}
	public void setMaintain(boolean maintain) {
		this.maintain = maintain;
	}
	public LocalDateTime getOpenTime() {
		return openTime;
	}
	public void setOpenTime(LocalDateTime openTime) {
		this.openTime = openTime;
	}
	public Set<Integer> getMergeServers() {
		return mergeServers;
	}
	public void setMergeServers(Set<Integer> mergeServers) {
		this.mergeServers = mergeServers;
	}
	public LocalDateTime getDailyTime() {
		return dailyTime;
	}
	public void setDailyTime(LocalDateTime dailyTime) {
		this.dailyTime = dailyTime;
	}
	public long getHeartBeatTime() {
		return heartBeatTime;
	}
	public void setHeartBeatTime(long heartBeatTime) {
		this.heartBeatTime = heartBeatTime;
	}
}
